package jcrosswords.domain;


public class ClueResponseInstance implements Value {

	private ClueResponse clueResponse;
	private Coordinates cellCoordinates;
	private Orientation orientation;
	private Direction direction;
	
	public ClueResponseInstance(ClueResponse clueResponse, Coordinates cellCoordinates, Orientation orientation, Direction direction) {
		setClueResponse(clueResponse);
		setCellCoordinates(cellCoordinates);
		setOrientation(orientation);
		setDirection(direction);
	}
	
	public ClueResponse getClueResponse() {
		return clueResponse;
	}
	
	private void setClueResponse(ClueResponse clueResponse) {
		this.clueResponse = clueResponse;
	}
	
	public Coordinates getCellCoordinates() {
		return cellCoordinates;
	}
	
	private void setCellCoordinates(Coordinates cellCoordinates) {
		this.cellCoordinates = cellCoordinates;
	}
	
	public Orientation getOrientation() {
		return orientation;
	}

	private void setOrientation(Orientation orientation) {
		this.orientation = orientation;
	}

	public Direction getDirection() {
		return direction;
	}

	private void setDirection(Direction direction) {
		this.direction = direction;
	}
	
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result
				+ ((cellCoordinates == null) ? 0 : cellCoordinates.hashCode());
		result = prime * result
				+ ((clueResponse == null) ? 0 : clueResponse.hashCode());
		result = prime * result
				+ ((direction == null) ? 0 : direction.hashCode());
		result = prime * result
				+ ((orientation == null) ? 0 : orientation.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		ClueResponseInstance other = (ClueResponseInstance) obj;
		if (cellCoordinates == null) {
			if (other.cellCoordinates != null)
				return false;
		} else if (!cellCoordinates.equals(other.cellCoordinates))
			return false;
		if (clueResponse == null) {
			if (other.clueResponse != null)
				return false;
		} else if (!clueResponse.equals(other.clueResponse))
			return false;
		if (direction == null) {
			if (other.direction != null)
				return false;
		} else if (!direction.equals(other.direction))
			return false;
		if (orientation == null) {
			if (other.orientation != null)
				return false;
		} else if (!orientation.equals(other.orientation))
			return false;
		return true;
	}

}